package com.linkhub.oms.data.sync.api.yunexpress.domain.response;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * @Description: 查询跟踪号响应
 * @Author: Jaycle
 * @Date: 2024/07/11 16:41
 * @Version: 1.0
 */
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
public class GetTrackingNumberResponse extends YunExpressBaseResponse implements Serializable {
    @JSONField(serialize = false, deserialize = false)
    public boolean success() {
        return SUCCESS_CODE.equals(getCode()) && items != null && !items.isEmpty();
    }

    @JSONField(name = "Items")
    private List<Item> items;
    /**
     * code
     */
    @JSONField(name = "Code")
    private String code;
    /**
     * message
     */
    @JSONField(name = "Message")
    private String message;
    /**
     * requestId
     */
    @JSONField(name = "RequestId")
    private String requestId;
    /**
     * timeStamp
     */
    @JSONField(name = "TimeStamp")
    private String timeStamp;

    /**
     * Item
     */
    @NoArgsConstructor
    @Data
    public static class Item {
        /**
         * orderNumber
         */
        @JSONField(name = "OrderNumber")
        private String orderNumber;
        /**
         * customerOrderNumber
         */
        @JSONField(name = "CustomerOrderNumber")
        private String customerOrderNumber;
        /**
         * trackingNumber
         */
        @JSONField(name = "TrackingNumber")
        private String trackingNumber;
        /**
         * wayBillNumber
         */
        @JSONField(name = "WayBillNumber")
        private String wayBillNumber;
        /**
         * childTrackings
         */
        @JSONField(name = "ChildTrackings")
        private List<ChildTracking> childTrackings;
        /**
         * remark
         */
        @JSONField(name = "Remark")
        private String remark;
        /**
         * status
         */
        @JSONField(name = "Status")
        private Integer status;

        /**
         * ChildTracking
         */
        @NoArgsConstructor
        @Data
        public static class ChildTracking {
            /**
             * childOrderNumber
             */
            @JSONField(name = "ChildOrderNumber")
            private String childOrderNumber;
            /**
             * childTrackingNumber
             */
            @JSONField(name = "ChildTrackingNumber")
            private String childTrackingNumber;
        }
    }
}
